package com.swanclouds.redfish.chassis.domain;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.swanclouds.model.chassis.Chassis;
import com.swanclouds.redfish.common.redfish.Status;

import java.util.Map;

/**
 *  * Description:
 *  * Author:      zhangliqiang@asiacom.net.cn
 *  * Date:        2022-07-17 11:26.
 *  
 */
public class ChassisModel implements Chassis {

    @JsonProperty("Actions")
    private Map<String,Object> action;
    @JsonProperty("ManagerType")
    private String managerType;
    @JsonProperty("PowerState")
    private String powerState;
    @JsonProperty("UUID")
    private String UUID;

    @Override
    public String getManagerType() {
        return managerType;
    }

    @Override
    public String getPowerState() {
        return this.powerState;
    }

    public Map<String, Object> getAction() {
        return action;
    }

    public String getUUID() {
        return UUID;
    }

    /**指定机箱资源的访问路径**/
    @JsonProperty("@odata.id")
    private String dataId;

    /**指定机箱资源模型的OData描述信息**/
    @JsonProperty("@odata.context")
    private String context;

    /**指定机箱资源的类型**/
    @JsonProperty("@odata.type")
    private String type;

    /**指定机箱资源的ID，为机箱在机箱集合中的唯一标识**/
    @JsonProperty("Id")
    private String id;

    /**指定机箱资源的名称**/
    @JsonProperty("Name")
    private String name;

    /**机箱厂商信息**/
    @JsonProperty("Manufacturer")
    private String manufacturer;

    /**机箱型号信息**/
    @JsonProperty("Model")
    private String model;

    /**机箱序列号**/
    @JsonProperty("SerialNumber")
    private String serialNumber;

    /**指定机箱资源的定位指示
     灯的状态，包括：
     ● Lit
     ● Kff
     ● Blinking
     ● Unknown**/
    @JsonProperty("IndicatorLED")
    private String indicatorLED;

    /**指定机箱资源的访问路径**/
    @JsonProperty("Links")
    private Link links;

    /**机箱自定义信息**/
    @JsonProperty("Oem")
    private Map<String, Object> oem;

    /**指定机箱资源的状态，包
     括：
     ● State：机箱是否使能
     ● Health：机箱健康状态
     ● Severity：机箱的自定
     义健康状态**/
    @JsonProperty("Status")
    private Status status;

    public String getIndicatorLED() {
        return indicatorLED;
    }

    public Link getLinks() {
        return links;
    }

    @Override
    public String getDataId() {
        return this.dataId;
    }

    @Override
    public String getId() {
        return this.id;
    }

    @Override
    public String getName() {
        return this.name;
    }

    @Override
    public String getContext() {
        return this.context;
    }

    @Override
    public String getType() {
        return this.type;
    }

    @Override
    public String getManufacturer() {
        return this.manufacturer;
    }

    @Override
    public String getModel() {
        return this.model;
    }

    @Override
    public String getSerialNumber() {
        return this.serialNumber;
    }


    @Override
    public String toString() {
        ObjectMapper objectMapper = new ObjectMapper();
        try {
            return objectMapper.writeValueAsString(this);
        } catch (JsonProcessingException e) {
        }
        return "ChassisModel{" +
                "action=" + action +
                ", managerType='" + managerType + '\'' +
                ", powerState='" + powerState + '\'' +
                ", UUID='" + UUID + '\'' +
                ", dataId='" + dataId + '\'' +
                ", context='" + context + '\'' +
                ", type='" + type + '\'' +
                ", id='" + id + '\'' +
                ", name='" + name + '\'' +
                ", status='" + status + '\'' +
                ", manufacturer='" + manufacturer + '\'' +
                ", model='" + model + '\'' +
                ", serialNumber='" + serialNumber + '\'' +
                ", oem='" + oem + '\'' +
                '}';
    }
}
